//
//  RViewController.swift
//  CheckmeRing
//
//  Created by 董鹏 on 2022/2/14.
//

import UIKit
import SVProgressHUD

class RViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        if self.navigationController?.viewControllers.count ?? 1 > 1 {
            self.navigationItem.leftBarButtonItem = self.customCommentLeftBarButtonItem
        }else {
            self.navigationItem.leftBarButtonItem = nil
        }
        self.view.backgroundColor = UIColor.white
    }
    
    var customCommentLeftBarButtonItem: UIBarButtonItem?{
        get{
            let backBtn = UIBarButtonItem(image: UIImage(named: "backIcon"), style: .done, target: self, action: #selector(popToBeforeViewController))
            backBtn.tintColor = hexColor("333333")
            return backBtn
        }
        
    }
    
    @objc open func popToBeforeViewController(){
        self.navigationController?.popViewController(animated: true)
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        SVProgressHUD.dismiss()
    }
    
}
